# encoding=utf-8
from django.shortcuts import render
from django.http import HttpResponse


def verify_api(fun):
    def verify(request):
        if request.method == 'POST':
            info = dict(request.POST)
            if info["api_pswd"][0] == "123":
                return fun(request)
            else:
                return HttpResponse("你没有权限浏览该网页")

        elif request.method == "GET":
            return HttpResponse("你没有权限浏览该网页")
    return verify


def verify_control(fun):
    def verify_con(request):
        if request.method == 'POST':
            return fun(request)
        elif request.method == 'GET':
            return HttpResponse("你没有权限浏览该网页")

    return verify_con


        
